package com.example.lemonhealth.controller;

import com.example.lemonhealth.service.LoginService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Author: Lemon
 * @Description: 登录相关接口
 * @Date: 2024/12/23 10:58
 */

@Controller
@Slf4j
public class LoginController {

    @Resource
    private LoginService loginService;

    /**
     * @Author Lemon
     * @Description 登录
     * @Date 2024/12/23 15:29
     * @Param [username, password]
     * @Return java.lang.String
     */
    @PostMapping("login.do")
    public String Login(@RequestParam String username, String password) {
        boolean isLogin = loginService.isLogin(username,password);
        if (isLogin) {
            return "redirect:/pages/main.html";
        }else {
            return "redirect:/pages/loading.html";
        }
    }

}
